package com.example.snut_system.controller;

import com.example.snut_system.exception.ApplicationException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2023-12-09
 * Time: 16:40
 */
// API 描述信息
@Api(tags = "TestController 测试接⼝")
@RequestMapping("/test")
@RestController
public class TestController {
    // API ⽅法描述
    @ApiOperation(value = "测试接⼝1，打印hello")
    @GetMapping("/hello")
    public String hello(){
        return  "hello zcx  is s13";
            }
    @ApiOperation(value = "测试接⼝3，返回⼀个异常结果")
    @GetMapping("/exception")
    public String testException() throws Exception {
        throw new Exception("这是⼀个Exception");
    }
    @ApiOperation(value = "测试接⼝3，返回⼀个⾃定义异常结果")
    @GetMapping("/appException")
    public String testApplicationException() {
        throw new ApplicationException("这是⼀个⾃定义的ApplicationException");
    }
}
